cmake_minimum_required(VERSION 2.4)

# project name
SET(PROJECTNAME anet)

# set out put path
SET(LIBRARY_OUTPUT_PATH ./lib)

# project name.
project(${PROJECTNAME})

# c or cpp compiler.
SET(CMAKE_C_COMPILER gcc)
SET(CMAKE_CXX_COMPILER g++)

# find lib at /usr/lib
FIND_LIBRARY(PTHREAD_LIB pthread /usr/lib)

# include directories.
INCLUDE_DIRECTORIES(
    ./
    ./asio
    ./util
    ./log
    ./timer
    ./pool
    ./msgpack-c
    ./rpc
    )

#definition flag
add_definitions(
	-std=c++17 
	-g 
	-O3 
	-Wall
    # -Wno-unused-variable
	# -Wno-deprecated
)

# source directory setting.
file(GLOB SRC_FILES "*.cpp" "*.hpp" "*.h" "*.c" "*.cc")
aux_source_directory(./timer TIMER_SRC)
aux_source_directory(./log LOG_SRC)
aux_source_directory(./pool POOL_SRC)
aux_source_directory(./util UTIL_SRC)

#set src files
#merge all sourses files to SRC.
set(SRC
    ${SRC_FILES}
    ${TIMER_SRC}
    ${LOG_SRC}
    ${POOL_SRC}
    ${UTIL_SRC}
   )

# .so or .a file output.
#ADD_LIBRARY(${PROJECTNAME} SHARED ${SRC})
ADD_LIBRARY(${PROJECTNAME} STATIC ${SRC})

